#ifdef _WIN32
#ifndef STRAY_GRAPHICS_SET_FACTORY_DX9_H
#define STRAY_GRAPHICS_SET_FACTORY_DX9_H

#include <Windows.h>
#include <d3d9.h>

#include "../../Common.h"
#include "../../SmartPtr/IntrusivePtr.h"
#include "../../Thread/Mutex.h"
#include "../../Thread/Condition.h"
#include "ContextDX9.h"
#include "DeviceDX9.h"
#include "ViewDX9.h"

namespace Stray {
namespace Core {
namespace Graphics {
namespace DirectX9 {

class GraphicsSetFactoryDX9
{
	friend void createDeviceMessageSender(const WindowHandle& handle, const GraphicsParameter& param, GraphicsSetFactoryDX9 *pThis);
public:
	GraphicsSetFactoryDX9(const WindowHandle& handle, const GraphicsParameter& param);

	static void createDevice(const WindowHandle& handle, const GraphicsParameter& param, GraphicsSetFactoryDX9 *pThis);

	DeviceDX9Ptr getDevice() const;
	ContextDX9Ptr getContext() const;
	ViewDX9Ptr getView() const;

private:
	IDirect3D9 *pD3D9_;
	IDirect3DDevice9 *pDevice_;
	IDirect3DSwapChain9 *pSwapChain_;

	DeviceDX9Ptr	spDevice_;
	ContextDX9Ptr	spContext_;
	ViewDX9Ptr		spView_;

	void checkDeviceCaps();
};

}
}
}
}

#endif
#endif